package com.zf.mo.quartz;

import org.quartz.*;

@DisallowConcurrentExecution //禁止并发执行job
@PersistJobDataAfterExecution //持久化值
public class MyJob implements Job {
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
      //  System.out.println("my job the date is "+ new Date());
      /*  JobDataMap jobDataMap = context.getMergedJobDataMap();
        System.out.println("job: "+jobDataMap.get("job"));
        System.out.println("trigger: "+jobDataMap.get("trigger"));*/

/*        try {
            System.out.println("this job chrrent date "+new Date());
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }*/

        JobDataMap jobDataMap = context.getJobDetail().getJobDataMap();
        System.out.println("count 值: "+(int)jobDataMap.get("count"));
        jobDataMap.put("count",(int)jobDataMap.get("count")+1);
    }
}
